package com.wzxy.wzinfo.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.wzxy.util.MyTimeUtils;
import com.wzxy.wzinfo.entiry.Operation;
import com.wzxy.wzinfo.repository.OperationRepository;
import com.wzxy.wzinfo.service.IOperationService;

@Service
@Transactional
public class OperationService extends MyJpaService<Operation,Integer> implements IOperationService{

	private OperationRepository operationRepository;
	
	@Autowired
	public void setOperationRepository(OperationRepository operationRepository) {
		this.operationRepository = operationRepository;
		super.setJpaRepository(operationRepository);
		super.setJpaSpecificationExecutor(operationRepository);
	}

	public void recordOperation(Operation operation) {
		operation.setTime(MyTimeUtils.getHasHourString());
		operationRepository.save(operation);
	}
}
